package com.ft.turorial.spring.boot.repository;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import com.ft.turorial.spring.boot.domain.User;

@Transactional
public interface UserDao extends CrudRepository<User, Integer> {
	
    @Modifying
    @Query("update User t set t.name = :name where t.id = :id")
    int updateNameById(@Param("name") String name, @Param("id") int id);

    @Query("select t from User t ")
    List<User> getList();
}
